package designPattern.creation5.factory.SimleFactory;


import designPattern.creation5.factory.common.HPMouse;
import designPattern.creation5.factory.common.IMouse;
import designPattern.creation5.factory.common.LenoveMouse;

public class MouseFactory1 {
    /// <param name="type">0 代码惠普鼠标 1 代码联想鼠标</param>
    /// <returns></returns>
    public IMouse getMouse(int type) {
        //在增加新的鼠标类型的时候这里需要修改，违背了开放封闭原则
        if (type == 0) {
            return new HPMouse();
        } else if (type == 1) {
            return new LenoveMouse();
        } else {

            System.out.println("请输入正确类型！");
            return null;
        }
    }
}